#pragma once
#include "HPReferenceCount.h"

HPReferenceCount::HPReferenceCount()
{
	iReferenceCount = 0;
}
virtual HPReferenceCount::~HPReferenceCount()
{
		
}
void HPReferenceCount::retain()
{
	int* k=&(this->iReferenceCount);
	_asm
	{
		mov eax, dword ptr[k]
		lock add dword ptr[eax], 1
	}

}
void HPReferenceCount::release()
{
	int* k=&(this->iReferenceCount);
	_asm
	{
		mov eax, dword ptr[k]
		lock add add dword ptr[eax], 0FFFFFFFFh
	}
	if(iReferenceCount <= 0)
	{
		if(this != NULL)
		{
			delete(this);
		}
	}
}